/*************************************************************************
	> File Name: client.c
	> Author: 
	> Mail: 
	> Created Time: Sat 10 Apr 2021 09:05:24 PM CST
 ************************************************************************/

#include "head.h"

int main() {
	int sockfd;
	int port = 10086;
    char buff[512] = "hello world", ip[20] = "47.111.117.240";

    // 放置“捕鼠夹”，处理SIGINT信号（Ctrl+C)
    // 连接服务端
    if ((sockfd = socket_connect(ip, port)) < 0) {
        perror("socket_connect");
        exit(1);
    }

    printf("before loop\n");
    // while (1) {
        // printf("<input> : ");
        // scanf("%[^\n]s", buff);
        // getchar();
        // if (!strlen(buff)) continue;
        // 注意这里的是strlen(buff)
        send(sockfd, buff, strlen(buff), 0); // 有什么发什么
        printf("sending %s...\n", buff);
		// sleep(60);
		int sockfd_tmp = sockfd;
		close(sockfd_tmp);
		sleep(10000);
        // bzero(buff, sizeof(buff));
        // 接受服务端回来的信息
        // recv(sockfd, buff, sizeof(buff), 0);
        // printf("<Server> : %s\n", buff);
        // bzero(buff, sizeof(buff));
    // }

    return 0;

	
}